package com.spring.housing1.controller.commen;

import com.spring.housing1.constant.ServiceTokenRequired;
import com.spring.housing1.constant.isNull;
import com.spring.housing1.returnType.CommenResult;
import com.spring.housing1.server.ExecutorServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/*
 * 更新接口
 * */
@RestController
public class UpdateController {
    @Autowired
    ExecutorServer loginServer;

    /*
     * 新增就诊卡信息  status  200，201
     * */
    @ServiceTokenRequired
    @isNull({"real_name","open_id","cell_phone","identify_id","defaults","enable"})
    @GetMapping("/insertCards")
    CommenResult<Object> insertCards(@RequestParam Map<String,String> cardInfo) throws Exception {
        return  loginServer.insertCards(cardInfo);
    }
    /*
     * 删除就诊卡信息
     * */
    @ServiceTokenRequired
    @isNull({"open_id","identify_id"})
    @GetMapping("/updateCards")
    CommenResult<Object> updateCards(@RequestParam Map<String,String> cardInfo) throws Exception {
        return  loginServer.updateCards(cardInfo);
    }


    /*
     * 修改就诊卡信息
     * */
    @ServiceTokenRequired
    @isNull({"open_id","identify_id"})
    @GetMapping("/modifyCards")
    CommenResult<Object> modifyCards(@RequestParam Map<String,String> cardInfo) throws Exception {
        return  loginServer.modifyCards(cardInfo);
    }
    /*
     * 修改用户信息
     * */
    @ServiceTokenRequired
    @isNull({"open_id"})
    @GetMapping("/modifyUsersInfo")
    CommenResult<Object> modifyUsersInfo(@RequestParam Map<String,String> cardInfo) throws Exception {
        return  loginServer.modifyUsersInfo(cardInfo);
    }


}
